unit URadiologyRequestSub;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, AdvPanel, cxGraphics,
  cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
  dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
  dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
  dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
  dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
  dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver,
  dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
  dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
  dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010,
  dxSkinWhiteprint, dxSkinXmas2008Blue, cxGroupBox, DBAdvGlowNavigator,
  cxStyles, dxSkinscxPCPainter, cxCustomData, cxFilter, cxData, cxDataStorage,
  cxNavigator, Data.DB, cxDBData, cxGridLevel, cxClasses, cxGridCustomView,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, UDMLab,
  cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, Vcl.StdCtrls, Vcl.Menus, cxButtons;

type
  TFRadiologyRequestSub = class(TForm)
    AdvPanel1: TAdvPanel;
    AdvPanelStyler1: TAdvPanelStyler;
    cxGroupBox1: TcxGroupBox;
    AdvPanel2: TAdvPanel;
    Label1: TLabel;
    cxButton1: TcxButton;
    cxLookupComboBox1: TcxLookupComboBox;
    procedure cxButton1Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FRadiologyRequestSub: TFRadiologyRequestSub;

implementation

{$R *.dfm}

procedure TFRadiologyRequestSub.cxButton1Click(Sender: TObject);
var
  buttonSelected : Integer;
begin
  DMLab.his_test_request_radio_sub.Insert;
  DMLab.his_test_request_radio_sub.FieldByName('his_test_request_radio_id').Value := DMLab.his_test_request_radio.FieldByName('his_test_request_radio_id').Value;
  DMLab.his_test_request_radio_sub.FieldByName('item_id').Value := Self.cxLookupComboBox1.EditValue;
  DMLab.his_test_request_radio_sub.Post;
  DMLab.his_test_request_radio_sub.RefreshRecord;
  buttonSelected := MessageDlg('Do you want to add more tests',mtCustom, [mbYes,mbCancel], 0);
  if buttonSelected = 2 then Self.Close;
end;

procedure TFRadiologyRequestSub.FormActivate(Sender: TObject);
begin
  DMLab.his_radiology_items_list.Refresh;
end;

end.
